import java.util.Arrays;

public class ThirdQuestion {
    /*public static void main(String[] args) {

        int[] num=new int[10];
        for (int i = 0; i <num.length ; i++) {
            num[i]=(int)(Math.random()*100);
            System.out.println(num[i]);
        }
        Arrays.sort(num);
        int max=num[num.length-1];
        int min=num[0];
        System.out.println("最大值为："+max);
        System.out.println("最小值为："+min);
    }*/
    public static void MaxAndMin(int[] num){
        
       int max=num[0];
       int min=num[0];
        for (int i = 0; i <num.length ; i++) {
            if (max<num[i]){
                max=num[i];
            }
            if (min>num[i]){
                min=num[i];
            }
        }
        System.out.println("最大值为："+max);
        System.out.println("最小值为："+min);
    }

    public static void main(String[] args) {

        int[] num=new int[10];
        for (int i = 0; i <num.length ; i++) {
            num[i]=(int)(Math.random()*100);
            System.out.println(num[i]);
        }
        MaxAndMin(num);
    }
}
